package org.xxpay.pay.channel.yunhaofu;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.Assert;
import org.xxpay.common.unify.AbstractPaymentConfig;

public class YunhaofupayConfig extends AbstractPaymentConfig {

    public static final String CHANNEL_NAME = "yunhaofu";
    public static final String CHANMEL_NAME_WX_QR = CHANNEL_NAME + "_wx_qr";
    public static final String CHANMEL_NAME_ALI_QR = CHANNEL_NAME + "_ali_qr";
    public static final String CHANMEL_NAME_ALI_H5 = CHANNEL_NAME + "_ali_h5";

    public static final String RETURN_VALUE_SUCCESS = "SUCCESS";
    public static final String RETURN_VALUE_FAIL = "0"; // 失败返回码
    public static final String RET_SUCCESS = "10000"; // 提交成功
    public static final String RET_PAY_SUCCESS = "10100"; // 支付成功
    public static final String RESPONSE_RESULT_OK = "success"; // 返回上游成功
    public static final String RESPONSE_RESULT_FAIL = "fail";       // 返回上游失败

    YunhaofupayConfig (String payParam){
        Assert.notNull(payParam, "init quanmin config error");
        JSONObject object = JSON.parseObject(payParam);
        setMchId(object.getString("mchId"));
        setPrivateKey(object.getString("privateKey"));
        setRequestUrl(object.getString("requestUrl"));
        setPayMode(object.getString("type"));
    }
}
